package com.fsserver.facedetection.config;

import lombok.extern.slf4j.Slf4j;
import nu.pattern.OpenCV;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * OpenCV配置类
 * 用于初始化OpenCV库
 * 
 * @author fsserver
 * @since 2024-01-01
 */
@Slf4j
@Configuration
public class OpenCVConfig {

    /**
     * 初始化OpenCV库
     */
    @PostConstruct
    public void initOpenCV() {
        try {
            // 加载OpenCV本地库
            OpenCV.loadLocally();
            log.info("OpenCV库初始化成功");
        } catch (Exception e) {
            log.error("OpenCV库初始化失败", e);
            throw new RuntimeException("OpenCV库初始化失败", e);
        }
    }
} 